package cn.wolfcode.crm.Service.impl;


import cn.wolfcode.crm.Service.ISystemDictionaryItemService;
import cn.wolfcode.crm.domain.SystemDictionaryItem;
import cn.wolfcode.crm.mapper.SystemDictionaryItemMapper;
import cn.wolfcode.crm.query.SystemDictionaryItemQueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryItemServiceImpl implements ISystemDictionaryItemService {
    @Autowired
    private SystemDictionaryItemMapper systemDictionaryItemMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        int i = systemDictionaryItemMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public int insert(SystemDictionaryItem record) {
        int i = systemDictionaryItemMapper.insert(record);
        return  i;
    }

    @Override
    public SystemDictionaryItem selectByPrimaryKey(Long id) {
        SystemDictionaryItem systemDictionaryItem = systemDictionaryItemMapper.selectByPrimaryKey(id);
        return systemDictionaryItem;
    }




    @Override
    public int updateByPrimaryKey(SystemDictionaryItem record) {
        int i = systemDictionaryItemMapper.updateByPrimaryKey(record);
        return i;
    }


    @Override
    public PageInfo<SystemDictionaryItem> queryForList(SystemDictionaryItemQueryObject qo) {
        //查询结果集
        //告诉mybatis,下面紧跟的查询需要分页
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),"sequence DESC");
        List<SystemDictionaryItem> list = systemDictionaryItemMapper.queryForList(qo);
        return new PageInfo<>(list);
    }

    @Override
    public List<SystemDictionaryItem> listItemByParentSn(String parentSn) {
        return systemDictionaryItemMapper.listItemByParentSn(parentSn);
    }
}




















